package com.twt.recruit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.twt.recruit.entity.Project;
import com.twt.recruit.entity.dto.RecruitDate;
import com.twt.recruit.entity.vo.GroupParam1;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ProjectMapper extends BaseMapper<Project> {

    @Select("select group_info.group_id, group_info.group_name,project_group.group_order " +
            "from group_info left join project_group on project_group.group_id = group_info.group_id " +
            "where project_id=#{projectId}")
    List<GroupParam1> selectGroupsByProjectId(Integer projectId);



    @Select("select project_id, title, status, end_time from project where club_id = #{clubId}")
    List<Project> listProjectByClubId(Integer clubId);

    @Delete("delete from project where project_id = #{projectId}")
    void delProjectByProjectId(Integer projectId);

    @Select("select start_time, end_time from project where project_id = #{projectId}")
    RecruitDate getBeginAndEnd(Integer projectId);

}
